package com.ss.android.article.base.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;

import java.lang.ref.WeakReference;

public class DragDismissListView extends ListView {
    interface a {
        void a();
    }

    boolean a;
    private int b;
    private int c;
    private WeakReference d;

    public DragDismissListView(Context arg1) {
        super(arg1);
        this.a();
    }

    public DragDismissListView(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
        this.a();
    }

    private void a() {
        this.setOnScrollListener(new o(this));
    }

    public boolean dispatchTouchEvent(MotionEvent arg3) {
        switch (arg3.getAction()) {
            case 0: {
                this.b = ((int) arg3.getY());
                break;
            }
            case 1: {
                this.b = 0;
                this.c = 0;
                this.a = false;
                break;
            }
            case 2: {
                this.c = ((int) arg3.getY());
                if (this.c - this.b <= 50) {
//                    goto label_3;
                } else if (!this.a) {
//                    goto label_3;
                } else {
                    Object v0 = this.d != null ? this.d.get() : null;
                    if (v0 == null) {
//                    goto label_3;
                    } else {
                        ((a) v0).a();
                        break;
                    }
                }
            }
        }

//        label_3:
        return super.dispatchTouchEvent(arg3);
    }

    public void setOnDrag(a arg2) {
        this.d = new WeakReference(arg2);
    }
}

